const logoutA = document.querySelector(".logout a");
logoutA.addEventListener("click", function (e) {
  if (confirm("是否退出登录?")) {
    localStorage.removeItem("cms90");
    location.href = "/login.html";
  }
});
const navA = document.querySelectorAll(".nav>li>a");
const navUlA = document.querySelectorAll(".nav ul a");
navA.forEach((ele) => {
  ele.addEventListener("click", function (e) {
    // this.nextElementSibling.classList.toggle('show')
    $(this.nextElementSibling).slideToggle();
  });
});
navUlA.forEach((ele) => {
  ele.addEventListener("click", function (e) {
    document.querySelector("a.active").classList.remove("active");
    e.target.classList.add("active");
  });
});
const init = document.querySelector(".init");
init.addEventListener("click", async function (e) {
  const res = await axios({
    url: "/init/data",
    // headers: {
    //   Authorization: localStorage.getItem("cms90"),
    // },
  });
  console.log(res);
  if (res.data.code == 0) {
    toastr.success(res.data.message);
  }
});
